/**
 * @file       CIniFileParser.h
 * @brief      
 * @author     LiuJkun
 * @version    1.0.0
 */

/*********************************************************************
 *  LiuJikun   10/03/09      Initial Version
 *********************************************************************/

#ifndef  CINIFILEPARSER_INC
#define  CINIFILEPARSER_INC

#include	<string>
#include	<fstream>
#include	<map>

typedef std::map< std::string, std::string > KeyValueMap_t;
typedef std::map< std::string, KeyValueMap_t > ValueGroups_t;

#define	INI_FILE_FIELD_SPLITTER '='			//
/**
 * @class  CIniFileParser
 * @brief  
 * @author LiuJkun
 * @date   10/03/09
 */
class CIniFileParser 
{
    public:

        // ====================  LIFECYCLE     =======================================
        CIniFileParser ( );                             // constructor

        // ====================  ACCESSORS     =======================================

        // ====================  MUTATORS      =======================================

        // ====================  OPERATORS     =======================================
        
        bool parse( const char *config_file );
        KeyValueMap_t &operator [] ( const char *key );

    protected:
        // ====================  DATA MEMBERS  =======================================

    private:
        // ====================  DATA MEMBERS  =======================================
        ValueGroups_t _m_groups;
        std::string _m_configFile;
        KeyValueMap_t _m_nullGroup;
}; 

#endif   // ----- #ifndef CINIFILEPARSER_INC  -----
